package com.ae.shield.common.items.util;

import net.minecraft.util.DamageSource;

public enum DamageSorter {
    CLOSE, REMOTE, MAGIC, OTHER, SHIELD;

    public static DamageSorter sort(DamageSource source) {

//---------------------------------------------判定为魔法-----------------------------------------------------------------
        if (source.isMagicDamage()) {
            return MAGIC;
        }

        switch (source.getDamageType()) {
            case "dragonBreath":
            case "wither":
                return MAGIC;
        }

//---------------------------------------------判定为远程-----------------------------------------------------------------

        if (source.isProjectile() || source.isExplosion()) {
            return REMOTE;
        }

//---------------------------------------------判定为近战-----------------------------------------------------------------

        switch (source.getDamageType()) {
            case "mob":
            case "player":
                return CLOSE;
        }

//---------------------------------------------判定为护盾-----------------------------------------------------------------
        if (source.getDamageType().equals("shield_maker")) {
            return SHIELD;
        }
        return OTHER;
    }
}
